﻿using Coater.Base;
using Coater.Dao;
using Coater.Domain;

namespace Coater.Config
{
    /// <summary>
    /// Io设备配置信息读取处理类
    /// </summary>
    public class IOCfgHandler : IDeviceConfig
    {
        public string DomainFullName { get; } = typeof(IoInfo).FullName!;
       
        /// <inheritdoc />
        public int Order { get; } = 1;

        /// <inheritdoc />
        public ConfigResult<T> LoadConfig<T>() where T : class
        {
            var configResult = new ConfigResult<T>();

            IOInfoConfigDao ioInfoConfigDao = new IOInfoConfigDao();
            var infoConfigList = ioInfoConfigDao.GetList().Result;

            configResult.DeviceInfos = infoConfigList as List<T>;
            configResult.Success = true;

            return configResult;
        }
    }
}
